package com.sprouting.personal.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sprouting.personal.dao.DynamicDataDetailedDao;
import com.sprouting.personal.model.entity.DynamicDataDetailed;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 动态数据明细
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2023/1/30 10:38
 */
@Service
@Slf4j
public class DynamicDataDetailedService extends ServiceImpl<DynamicDataDetailedDao, DynamicDataDetailed> {

    @Resource
    private DynamicDataDetailedDao dynamicDataDetailedDao;

    /**
     * 根据查询动态明细
     * @param page 分页参数
     * @param dynamicDataDetailed 查询参数
     * @return
     */
    public Page<DynamicDataDetailed> getDynamicDataDetailedListPage(Page page, DynamicDataDetailed dynamicDataDetailed) {
        return dynamicDataDetailedDao.getDynamicDataDetailedListPage(page, dynamicDataDetailed);
    }

    /**
     * 查询时间是否已经有数据
     * @param id 主键，传则忽略该ID
     * @param userId 当前登录ID
     * @param entryTime 要验证的时间
     * @param dynamicId 动态主表ID
     * @return
     */
    public DynamicDataDetailed getDynamicDataDetailedByEntryTime(String id, String userId, Date entryTime, String dynamicId) {
        return dynamicDataDetailedDao.getDynamicDataDetailedByEntryTime(id, userId, entryTime, dynamicId);
    }
}
